package 笔试.贝壳;

import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);


    }

    public long[] FarmerNN (int n, long m) {
        // write code here
        long[] res = new long[n];
        if(m<=n){
            for(int i=0;i<m;i++){
                res[i] = 1;
            }
            return res;
        }
        for (int i = 0; i < n; i++) {
            res[i] = 1;
        }
        long a = (m-n)/(n-1);
        long b = (m-n)%(n-1);
        if(a%2==0){
            for(int i=0;i<n;i++){
                if(i==0 || i==n-1){
                    res[i] += a/2;
                }else{
                    res[i] += a;
                }
            }
            for (int i = n-2; i >=n-b-1; i--) {
                res[i]++;
            }
        }else{
            for (int i = 0; i < n; i++) {
                if(i==0){
                    res[i] += a/2+1;
                }else if(i==n-1){
                    res[i] += a/2;
                }else{
                    res[i] += a;
                }
            }
            for (int i = 1; i<=b; i++) {
                res[i]++;
            }
        }
       return res;


    }
}
